package com.ifdom.collection;

import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;

/**
 * @Author ifredomvip@gmail.com
 * @Date 2022/9/16 10:08
 * @Version 1.0.0
 * @Description
 **/

public class SetFromWeakHashMap {

    public static void main(String[] args) {
        Map<String, Boolean> weakMap = new WeakHashMap<>();
        weakMap.put("1", true);
        Set<String> set = Collections.newSetFromMap(weakMap);

        set.add("a");
        set.add("b");
        set.add("c");
        set.add("d");

        System.out.println(weakMap);
        System.out.println(set);
    }
}
